#include "../userprog/syscall.h"
void main(){

char* execName;
int nameLen;

int latestIndex;
int NUM_GROUPS;
int customerInitLock;
int customerInitCondition;
int NUM_CUSTOMERS;
int customerStartLock;
int numCustomersInTheater;

numCustomersInTheater = CreateMV(1, "numCustomersInTheater", 21);
customerStartLock = CreateLock("customerStartLock", 17);
NUM_CUSTOMERS = CreateMV(1, "NUM_CUSTOMERS", 13);
latestIndex = CreateMV(1, "latestIndex", 11);
NUM_GROUPS = CreateMV(1, "NUM_GROUPS", 10);
customerInitLock = CreateLock("customerInitLock",16);
customerInitCondition = CreateCondition("customerInitCondition",21);


	for(SetMV(latestIndex,0,0); GetMV(latestIndex,0) < GetMV(NUM_GROUPS,0); SetMV(latestIndex,0,GetMV(latestIndex,0) + 1))
	{
		AcquireLock(customerInitLock);

		execName = "../test/customer";
		nameLen = 16;
		Exec(execName, nameLen);
		
		WaitCondition(customerInitCondition, customerInitLock);
		AcquireLock(customerStartLock);
		ReleaseLock(customerStartLock);
		ReleaseLock(customerInitLock);
	}
	
	SetMV(NUM_CUSTOMERS,0,GetMV(numCustomersInTheater,0));
	}